﻿function linkToLoad(mainObject) {
    $("a").removeAttr("onclick");
    $("a").click(function() { loadInContainer(this.href, mainObject); return false; });
    //TODO: 外部連結改為由新分頁開啟
}

function loadInContainer(addr, container) {
    container.load(addr, function(response, status, xhr) {
        if (status == "error") {
            //載入err.html
            var msg = "Sorry but there was an error: ";
            container.html(msg + xhr.status + " " + xhr.statusText);
        }
    });
    //linkToLoad(container);
}